﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract PrimanjeTip typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class PrimanjeTipDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<PrimanjeTipDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.PrimanjeTip _currentPrimanjeTip = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxPrimanjeTipDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxPrimanjeTipErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxPrimanjeTipBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Naziv property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxNazivDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Postotak property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPostotakDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the OsnovaOsiguranja property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxOsnovaOsiguranjaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the VrstaRada property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxVrstaRadaDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IndikatorID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIndikatorIDDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDVrstaRaspodjele property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDVrstaRaspodjeleDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.Sifarnik> _IndikatorIDList;
		
		/// <summary> 
		/// The list of selectable Sifarnik
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Sifarnik> IndikatorIDList
		{
			get {return this._IndikatorIDList;}
			set 
			{
				this._IndikatorIDList = value;
				this.uxIndikatorIDDataGridViewColumn.DataSource = null;
				this.uxIndikatorIDDataGridViewColumn.DataSource = this._IndikatorIDList;
			}
		}
		
		private bool _allowNewItemInIndikatorIDList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Sifarnik
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIndikatorIDList
		{
			get { return _allowNewItemInIndikatorIDList;}
			set
			{
				this._allowNewItemInIndikatorIDList = value;
				this.uxIndikatorIDDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Sifarnik> _VrstaRadaList;
		
		/// <summary> 
		/// The list of selectable Sifarnik
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Sifarnik> VrstaRadaList
		{
			get {return this._VrstaRadaList;}
			set 
			{
				this._VrstaRadaList = value;
				this.uxVrstaRadaDataGridViewColumn.DataSource = null;
				this.uxVrstaRadaDataGridViewColumn.DataSource = this._VrstaRadaList;
			}
		}
		
		private bool _allowNewItemInVrstaRadaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Sifarnik
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInVrstaRadaList
		{
			get { return _allowNewItemInVrstaRadaList;}
			set
			{
				this._allowNewItemInVrstaRadaList = value;
				this.uxVrstaRadaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Sifarnik> _OsnovaOsiguranjaList;
		
		/// <summary> 
		/// The list of selectable Sifarnik
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Sifarnik> OsnovaOsiguranjaList
		{
			get {return this._OsnovaOsiguranjaList;}
			set 
			{
				this._OsnovaOsiguranjaList = value;
				this.uxOsnovaOsiguranjaDataGridViewColumn.DataSource = null;
				this.uxOsnovaOsiguranjaDataGridViewColumn.DataSource = this._OsnovaOsiguranjaList;
			}
		}
		
		private bool _allowNewItemInOsnovaOsiguranjaList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Sifarnik
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInOsnovaOsiguranjaList
		{
			get { return _allowNewItemInOsnovaOsiguranjaList;}
			set
			{
				this._allowNewItemInOsnovaOsiguranjaList = value;
				this.uxOsnovaOsiguranjaDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.VrstaRaspodjele> _IDVrstaRaspodjeleList;
		
		/// <summary> 
		/// The list of selectable VrstaRaspodjele
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.VrstaRaspodjele> IDVrstaRaspodjeleList
		{
			get {return this._IDVrstaRaspodjeleList;}
			set 
			{
				this._IDVrstaRaspodjeleList = value;
				this.uxIDVrstaRaspodjeleDataGridViewColumn.DataSource = null;
				this.uxIDVrstaRaspodjeleDataGridViewColumn.DataSource = this._IDVrstaRaspodjeleList;
			}
		}
		
		private bool _allowNewItemInIDVrstaRaspodjeleList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of VrstaRaspodjele
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDVrstaRaspodjeleList
		{
			get { return _allowNewItemInIDVrstaRaspodjeleList;}
			set
			{
				this._allowNewItemInIDVrstaRaspodjeleList = value;
				this.uxIDVrstaRaspodjeleDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.PrimanjeTip> _PrimanjeTipList;
				
		/// <summary> 
		/// The list of PrimanjeTip to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.PrimanjeTip> PrimanjeTipList
		{
			get {return this._PrimanjeTipList;}
			set
			{
				this._PrimanjeTipList = value;
				this.uxPrimanjeTipBindingSource.DataSource = null;
				this.uxPrimanjeTipBindingSource.DataSource = value;
				this.uxPrimanjeTipDataGridView.DataSource = null;
				this.uxPrimanjeTipDataGridView.DataSource = this.uxPrimanjeTipBindingSource;				
				//this.uxPrimanjeTipBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxPrimanjeTipBindingSource_ListChanged);
				this.uxPrimanjeTipBindingSource.CurrentItemChanged += new System.EventHandler(OnPrimanjeTipBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnPrimanjeTipBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentPrimanjeTip = uxPrimanjeTipBindingSource.Current as Entities.PrimanjeTip;
			
			if (_currentPrimanjeTip != null)
			{
				_currentPrimanjeTip.Validate();
			}
			//_PrimanjeTip.Validate();
			OnCurrentEntityChanged();
		}

		//void uxPrimanjeTipBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.PrimanjeTip"/> instance.
		/// </summary>
		public Entities.PrimanjeTip SelectedPrimanjeTip
		{
			get {return this._currentPrimanjeTip;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxPrimanjeTipDataGridView.VirtualMode;}
			set
			{
				this.uxPrimanjeTipDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxPrimanjeTipDataGridView.AllowUserToAddRows;}
			set {this.uxPrimanjeTipDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxPrimanjeTipDataGridView.AllowUserToDeleteRows;}
			set {this.uxPrimanjeTipDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxPrimanjeTipDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxPrimanjeTipDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="PrimanjeTipDataGridViewBase"/> class.
		/// </summary>
		public PrimanjeTipDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxPrimanjeTipDataGridView = new System.Windows.Forms.DataGridView();
			this.uxPrimanjeTipBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxPrimanjeTipErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxNazivDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxPostotakDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxOsnovaOsiguranjaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxVrstaRadaDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIndikatorIDDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDVrstaRaspodjeleDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			//this.uxIndikatorIDBindingSource = new SifarnikBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIndikatorIDBindingSource)).BeginInit();
			//this.uxVrstaRadaBindingSource = new SifarnikBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxVrstaRadaBindingSource)).BeginInit();
			//this.uxOsnovaOsiguranjaBindingSource = new SifarnikBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxOsnovaOsiguranjaBindingSource)).BeginInit();
			//this.uxIDVrstaRaspodjeleBindingSource = new VrstaRaspodjeleBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDVrstaRaspodjeleBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxPrimanjeTipDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxPrimanjeTipBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxPrimanjeTipErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxPrimanjeTipErrorProvider
			// 
			this.uxPrimanjeTipErrorProvider.ContainerControl = this;
			this.uxPrimanjeTipErrorProvider.DataSource = this.uxPrimanjeTipBindingSource;						
			// 
			// uxPrimanjeTipDataGridView
			// 
			this.uxPrimanjeTipDataGridView.AutoGenerateColumns = false;
			this.uxPrimanjeTipDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxPrimanjeTipDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxNazivDataGridViewColumn,
		this.uxPostotakDataGridViewColumn,
		this.uxOsnovaOsiguranjaDataGridViewColumn,
		this.uxVrstaRadaDataGridViewColumn,
		this.uxIndikatorIDDataGridViewColumn,
		this.uxIDVrstaRaspodjeleDataGridViewColumn			});
			this.uxPrimanjeTipDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxPrimanjeTipDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxPrimanjeTipDataGridView.Name = "uxPrimanjeTipDataGridView";
			this.uxPrimanjeTipDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxPrimanjeTipDataGridView.TabIndex = 0;	
			this.uxPrimanjeTipDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxPrimanjeTipDataGridView.EnableHeadersVisualStyles = false;
			this.uxPrimanjeTipDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnPrimanjeTipDataGridViewDataError);
			this.uxPrimanjeTipDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnPrimanjeTipDataGridViewCellValueNeeded);
			this.uxPrimanjeTipDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnPrimanjeTipDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxNazivDataGridViewColumn
			//
			this.uxNazivDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxNazivDataGridViewColumn.DataPropertyName = "Naziv";
			this.uxNazivDataGridViewColumn.HeaderText = "Naziv";
			this.uxNazivDataGridViewColumn.Name = "uxNazivDataGridViewColumn";
			this.uxNazivDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxNazivDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxNazivDataGridViewColumn.ReadOnly = false;		
			//
			// uxPostotakDataGridViewColumn
			//
			this.uxPostotakDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPostotakDataGridViewColumn.DataPropertyName = "Postotak";
			this.uxPostotakDataGridViewColumn.HeaderText = "Postotak";
			this.uxPostotakDataGridViewColumn.Name = "uxPostotakDataGridViewColumn";
			this.uxPostotakDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPostotakDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPostotakDataGridViewColumn.ReadOnly = false;		
			//
			// uxOsnovaOsiguranjaDataGridViewColumn
			//
			this.uxOsnovaOsiguranjaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxOsnovaOsiguranjaDataGridViewColumn.DataPropertyName = "OsnovaOsiguranja";
			this.uxOsnovaOsiguranjaDataGridViewColumn.HeaderText = "OsnovaOsiguranja";
			this.uxOsnovaOsiguranjaDataGridViewColumn.Name = "uxOsnovaOsiguranjaDataGridViewColumn";
			this.uxOsnovaOsiguranjaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxOsnovaOsiguranjaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxOsnovaOsiguranjaDataGridViewColumn.ReadOnly = false;		
			//
			// uxVrstaRadaDataGridViewColumn
			//
			this.uxVrstaRadaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxVrstaRadaDataGridViewColumn.DataPropertyName = "VrstaRada";
			this.uxVrstaRadaDataGridViewColumn.HeaderText = "VrstaRada";
			this.uxVrstaRadaDataGridViewColumn.Name = "uxVrstaRadaDataGridViewColumn";
			this.uxVrstaRadaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxVrstaRadaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxVrstaRadaDataGridViewColumn.ReadOnly = false;		
			//
			// uxIndikatorIDDataGridViewColumn
			//
			this.uxIndikatorIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIndikatorIDDataGridViewColumn.DataPropertyName = "IndikatorID";
			this.uxIndikatorIDDataGridViewColumn.HeaderText = "IndikatorID";
			this.uxIndikatorIDDataGridViewColumn.Name = "uxIndikatorIDDataGridViewColumn";
			this.uxIndikatorIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIndikatorIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIndikatorIDDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDVrstaRaspodjeleDataGridViewColumn
			//
			this.uxIDVrstaRaspodjeleDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDVrstaRaspodjeleDataGridViewColumn.DataPropertyName = "IDVrstaRaspodjele";
			this.uxIDVrstaRaspodjeleDataGridViewColumn.HeaderText = "IDVrstaRaspodjele";
			this.uxIDVrstaRaspodjeleDataGridViewColumn.Name = "uxIDVrstaRaspodjeleDataGridViewColumn";
			this.uxIDVrstaRaspodjeleDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDVrstaRaspodjeleDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDVrstaRaspodjeleDataGridViewColumn.ReadOnly = false;		
			//
			// uxIndikatorIDDataGridViewColumn
			//				
			this.uxIndikatorIDDataGridViewColumn.DisplayMember = "IDSifarnikTip";	
			this.uxIndikatorIDDataGridViewColumn.ValueMember = "ID";	
			this.uxIndikatorIDDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIndikatorIDDataGridViewColumn.DataSource = uxIndikatorIDBindingSource;				
				
			//
			// uxVrstaRadaDataGridViewColumn
			//				
			this.uxVrstaRadaDataGridViewColumn.DisplayMember = "IDSifarnikTip";	
			this.uxVrstaRadaDataGridViewColumn.ValueMember = "ID";	
			this.uxVrstaRadaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxVrstaRadaDataGridViewColumn.DataSource = uxVrstaRadaBindingSource;				
				
			//
			// uxOsnovaOsiguranjaDataGridViewColumn
			//				
			this.uxOsnovaOsiguranjaDataGridViewColumn.DisplayMember = "IDSifarnikTip";	
			this.uxOsnovaOsiguranjaDataGridViewColumn.ValueMember = "ID";	
			this.uxOsnovaOsiguranjaDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxOsnovaOsiguranjaDataGridViewColumn.DataSource = uxOsnovaOsiguranjaBindingSource;				
				
			//
			// uxIDVrstaRaspodjeleDataGridViewColumn
			//				
			this.uxIDVrstaRaspodjeleDataGridViewColumn.DisplayMember = "Naziv";	
			this.uxIDVrstaRaspodjeleDataGridViewColumn.ValueMember = "ID";	
			this.uxIDVrstaRaspodjeleDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDVrstaRaspodjeleDataGridViewColumn.DataSource = uxIDVrstaRaspodjeleBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxPrimanjeTipDataGridView);
			this.Name = "PrimanjeTipDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIndikatorIDBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxVrstaRadaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxOsnovaOsiguranjaBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDVrstaRaspodjeleBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxPrimanjeTipErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxPrimanjeTipDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxPrimanjeTipBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				PrimanjeTipDataGridViewEventArgs args = new PrimanjeTipDataGridViewEventArgs();
				args.PrimanjeTip = _currentPrimanjeTip;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class PrimanjeTipDataGridViewEventArgs : System.EventArgs
		{
			private Entities.PrimanjeTip	_PrimanjeTip;
	
			/// <summary>
			/// the  Entities.PrimanjeTip instance.
			/// </summary>
			public Entities.PrimanjeTip PrimanjeTip
			{
				get { return _PrimanjeTip; }
				set { _PrimanjeTip = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxPrimanjeTipDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnPrimanjeTipDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxPrimanjeTipDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnPrimanjeTipDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxPrimanjeTipDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = PrimanjeTipList[e.RowIndex].ID;
						break;
					case "uxNazivDataGridViewColumn":
						e.Value = PrimanjeTipList[e.RowIndex].Naziv;
						break;
					case "uxPostotakDataGridViewColumn":
						e.Value = PrimanjeTipList[e.RowIndex].Postotak;
						break;
					case "uxOsnovaOsiguranjaDataGridViewColumn":
						e.Value = PrimanjeTipList[e.RowIndex].OsnovaOsiguranja;
						break;
					case "uxVrstaRadaDataGridViewColumn":
						e.Value = PrimanjeTipList[e.RowIndex].VrstaRada;
						break;
					case "uxIndikatorIDDataGridViewColumn":
						e.Value = PrimanjeTipList[e.RowIndex].IndikatorID;
						break;
					case "uxIDVrstaRaspodjeleDataGridViewColumn":
						e.Value = PrimanjeTipList[e.RowIndex].IDVrstaRaspodjele;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxPrimanjeTipDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnPrimanjeTipDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxPrimanjeTipDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						PrimanjeTipList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxNazivDataGridViewColumn":
						PrimanjeTipList[e.RowIndex].Naziv = (System.String)e.Value;
						break;
					case "uxPostotakDataGridViewColumn":
						PrimanjeTipList[e.RowIndex].Postotak = (System.Decimal?)e.Value;
						break;
					case "uxOsnovaOsiguranjaDataGridViewColumn":
						PrimanjeTipList[e.RowIndex].OsnovaOsiguranja = (System.Int32)e.Value;
						break;
					case "uxVrstaRadaDataGridViewColumn":
						PrimanjeTipList[e.RowIndex].VrstaRada = (System.Int32?)e.Value;
						break;
					case "uxIndikatorIDDataGridViewColumn":
						PrimanjeTipList[e.RowIndex].IndikatorID = (System.Int32?)e.Value;
						break;
					case "uxIDVrstaRaspodjeleDataGridViewColumn":
						PrimanjeTipList[e.RowIndex].IDVrstaRaspodjele = (System.Int32)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
